<?php require __DIR__.'/header.html';?>
<style>
	.url {
		word-break: break-all;
		cursor: pointer;
		margin-left: 5px;
		color: #777;
		border: none;
		border-radius: 0;
		border-bottom: 2px solid #5FB878;
	}

	.simpleTable {
		line-height: 20px;
		padding-bottom: 16px;
	}

	.linep {
		font-size: 14px;
		font-weight: 700;
		color: #555;
		padding-left: 14px;
		height: 16px;
		line-height: 16px;
		margin-bottom: 18px;
		position: relative;
		margin-top: 15px;
	}

	.linep:before {
		content: '';
		width: 4px;
		height: 16px;
		background: #00aeff;
		border-radius: 2px;
		position: absolute;
		left: 0;
		top: 0;
	}

	::-webkit-scrollbar {
		width: 9px;
		height: 9px
	}

	::-webkit-scrollbar-track-piece {
		background-color: #ebebeb;
		/* -webkit-border-radius: 4px */
	}

	::-webkit-scrollbar-thumb:vertical {
		height: 32px;
		background-color: #ccc;
		/* -webkit-border-radius: 4px */
	}

	::-webkit-scrollbar-thumb:horizontal {
		width: 32px;
		background-color: #ccc;
		/* -webkit-border-radius: 4px */
	}

	.layui-container {
		min-height: 273px;
	}
</style>
<div class="layui-container">
	<div class="layui-row">
		<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
			<legend><?php echo $data['info']['l_title'];?></legend>
		</fieldset>
		<blockquote class="layui-elem-quote"><?php echo $data['info']['l_desc'];?></blockquote>
	</div>
	<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
		<ul class="layui-tab-title" style="text-align: center!important;">
			<li class="layui-this">API文档</li>
			<li>错误码参照</li>
			<li>示例代码</li>
		</ul>
		<div class="layui-tab-content">
			<div class="layui-tab-item layui-show">
				<p class="simpleTable">
					<span class="layui-badge layui-bg-black">接口地址：</span>
					<span class="url" data-clipboard-text="<?php echo $data['info']['l_address'];?>">
						<?php echo $data['info']['l_address'];?>
					</span>
				</p>
				<p class="simpleTable">
					<span class="layui-badge layui-bg-green">返回格式：</span>
					<span class="url" data-clipboard-text="<?php echo $data['info']['l_format'];?>">
						<?php echo $data['info']['l_format'];?>
					</span>
				</p>
				<p class="simpleTable">
					<span class="layui-badge">请求方式：</span>
					<span class="url" data-clipboard-text="<?php echo $data['info']['l_mode'];?>">
						<?php echo $data['info']['l_mode'];?>
					</span>
				</p>
				<p class="simpleTable">
					<span class="layui-badge layui-bg-blue">请求示例：</span>
					<span class="url" data-clipboard-text="<?php echo $data['info']['l_ask'];?>">
						<?php echo $data['info']['l_ask'];?>
					</span>
				</p>
				<p class="linep">请求参数说明：</p>
				<table class="layui-table" lay-size="sm">
					<thead>
						<tr>
							<th>名称</th>
							<th>必填</th>
							<th>类型</th>
							<th>说明</th>
						</tr>
					</thead>
					<tbody>
						<?php if(!empty($data['val'])):
						foreach ($data['val'] as $k => $v) : 
						if($v['p_api_type']==0):?>
						<tr>
							<td><?php echo $v['p_name'];?></td>
							<td><?php echo $v['p_crux'];?></td>
							<td><?php echo $v['p_type'];?></td>
							<td><?php echo $v['p_desc'];?></td>
						</tr>
						<?php endif;
						endforeach;
						endif; ?>
					</tbody>
				</table>
				<p class="linep">返回参数说明：</p>
				<table class="layui-table" lay-size="sm">
					<thead>
						<tr>
							<th>名称</th>
							<th>类型</th>
							<th>说明</th>
						</tr>
					</thead>
					<tbody>
						<?php if(!empty($data['val'])):
						foreach ($data['val'] as $k => $v):
						if($v['p_api_type']==1):?>
						<tr>
							<td><?php echo $v['p_name'];?></td>
							<td><?php echo $v['p_type'];?></td>
							<td><?php echo $v['p_desc'];?></td>
						</tr>
						<?php endif;
						endforeach;
						endif; ?>
					</tbody>
				</table>
				<p class="linep">返回示例：</p>
				<pre class="layui-code"><?php echo $data['info']['l_example'];?></pre>
			</div>
			<div class="layui-tab-item">
				<p class="linep">错误码格式说明：</p>
				<table class="layui-table" lay-size="sm">
					<thead>
						<tr>
							<th>名称</th>
							<th>类型</th>
							<th>说明</th>
						</tr>
					</thead>
					<tbody>
						<?php if(!empty($data['val'])):
						foreach ($data['val'] as $k => $v) : 
						if($v['p_api_type']==2):?>
						<tr>
							<td><?php echo $v['p_name'];?></td>
							<td><?php echo $v['p_type'];?></td>
							<td><?php echo $v['p_desc'];?></td>
						</tr>
						<?php endif;
						endforeach;
						endif; ?>
					</tbody>
				</table>
			</div>
			<div class="layui-tab-item">
				<p class="linep">代码示例：</p>
				<pre class="layui-code"><?php echo nl2br(htmlspecialchars($data['info']['l_demo']));?></pre>
			</div>
		</div>
	</div>
</div>
<script src="/assets/other/js/clipboard.min.js"></script>
<script>
	layui.use('code', function () { //加载code模块
		layui.code(); //引用code方法
	});
	var clipboard = new ClipboardJS('.url');
	clipboard.on('success', function (e) {
		layer.msg('复制成功!');
	});
	clipboard.on('error', function (e) {
		layer.msg('复制成功!');
	});
</script>
<?php require __DIR__.'/footer.html';?>